1. Field of the Invention
The present invention relates to a stack memory employing a random access memory (RAM).
2. Description of the Prior Art
In conventional stack memories comprising so called Last-In-First-Out type memories, there are memories comprising a RAM.
Namely, in order to make such a stack memory function effectively, a RAM for receving and outputting data and a stack pointer comprising an up-down counter indicative of input and output addresses corresponding to data held in the RAM are required.
In such a stack memory, when write operation (PUSH) to the RAM is executed, external data are written to an address designated by the stack pointer, then the address is updated by incrementing it by "1". On the other hand, when a read operation (POP) from the RAM is executed, an address of the stack pointer is decremented by "1", then data are read out from a position designated by the decremented address.
Since the PUSH and POP operations of the stack memory are respectively carried out in such manners, it is necessary to decide in advance which of the POP and PUSH operations should be executed when access of the RAM is started. Namely, in such a conventional stack memory, the access operation of the RAM must be started after the PUSH or POP operation is decided. Therefore, in a system which uses such a conventional stack memory, the process speed is likely to be lowered.
For example, in case of a recursive algorithm where operation for temporarily holding data to be processed in a stack memory to read and use the data later on, the data process mode is first decided, then the data is processed in accordance with the PUSH operation to the stack memory or the POP operation from the stack memory.
In such a case, if the above-mentioned conventional stack memory is used, the access operation of the stack memory can not be started until the data process mode is decided. Therefore, the process speed is inevitably lowered.
Accordingly, in such a conventional stack memory, it is necessary to decide in advance which of the PUSH and POP operations should be executed before the access operation of the stack memory is started. Therefore, the process speed of the procedure including the operation relating to the stack memory is inevitably lowered.